package cate.game.role.pvp.teampvp.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTeamPvp;
import cate.game.pvp.teampvp.dto.TeamPvpTeamData;
import easy.java.dev.note.NoteField;

public class TeamPvpChangeLeaderReq implements MsgInput {
    @NoteField("新的队长uid")
    public String newLeaderUid;
    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<TeamPvpTeamData> r = game.pvp.teamPvp.changeLeader(cc.getRole(), newLeaderUid);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
            return;
        }
        cc.sendNow(new TeamPvpDataResp(cc.getRole(), r.data));
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTeamPvp.CHANGE_LEADER_REQ;
    }
}
